#ifndef _ATOMIC_0701_YSDD_H_
#define _ATOMIC_0701_YSDD_H_

/*------------------------ Include Begin --------------------------*/

// C
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <string>
#include <math.h>
#include <time.h>
#include <ctype.h>

// C++
#include <iostream>
#include <fstream>
#include <chrono>
#include <string>
#include <random>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <stdbool.h>
#include <sstream>


/*------------------------  Include End  -------------------------*/

/*------------------------  Service Info Begin  --------------------------*/
/**
 *
 * @name:     atomic_0701_ysdd
 * @chinese_name: 预设弹道信息
 * @description: information atomic_0701_ysdd
 * @version: V1.0.0
 * @build_time: 2024-05-23 16:00:00
 * @license: MIT
 * @service_path: atomic_0701_ysdd
 *
 * @resource_requirement:
 *         + cpu_architecture: x86_64
 *         + memory: 4GB
 *         + hard_disk: 50GB
 *
 * @developer:
 *      +name: Spiderman
 *      +email: Spidermsan@atomic_0701_ysdd.com
 * @maintainer:
 *      +name: yishui
 *      +email:yishui@atomic_0701_ysdd.com
 * @operating_system:
 *      +name:Linux
 *      +v1:5.13.0-117-generic
 *      +v2:5.14.0-117-generic
 *      +name:SylixOS
 *      +v1:1.0.0
 *      +v2:1.0.2
 *
 *
 *
 */
/*------------------------  Service Info End  --------------------------*/

/*------------------------  Return Type Begin  --------------------------*/

#define ATOMIC_SERVICE_SUCCESS 0
#define ATOMIC_SERVICE_FAIL -1
#define ATOMIC_SERVICE_TIMEOUT -2
#define ATOMIC_SERVICE_ERROR -3
#define ATOMIC_SERVICE_NOT_SUPPORT -4
#define ATOMIC_SERVICE_NOT_READY -5
#define ATOMIC_SERVICE_NOT_INIT -6
#define ATOMIC_SERVICE_NOT_START -7
#define ATOMIC_SERVICE_NOT_STOP -8
#define ATOMIC_SERVICE_NOT_RELEASE -9
#define ATOMIC_SERVICE_NOT_DESTROY -10
#define ATOMIC_SERVICE_NOT_CREATE -11
#define ATOMIC_SERVICE_NOT_OPEN -12
#define ATOMIC_SERVICE_NOT_CLOSE -13
#define ATOMIC_SERVICE_NOT_READ -14
#define ATOMIC_SERVICE_NOT_WRITE -15
#define ATOMIC_SERVICE_NOT_SEEK -16
#define ATOMIC_SERVICE_NOT_TELL -17
#define ATOMIC_SERVICE_NOT_SIZE -18
#define ATOMIC_SERVICE_NOT_SEEK_END -19
#define ATOMIC_SERVICE_NOT_SEEK_SET -20
#define ATOMIC_SERVICE_NOT_SEEK_CUR -21
#define ATOMIC_SERVICE_NOT_SEEK_ABS -22

/*------------------------  Return Type End  --------------------------*/

// 地球半径(m)
#define EARTH_RADIUS 6371000.0
#define PI 3.14159265358979323846

/*------------------------  Message Info Begin  --------------------------*/

// 输入结构体 (全部基本数据类型)
typedef struct
{
    double current_latitude;  // 当前纬度(度)
    double current_longitude; // 当前经度(度)
    double current_altitude;  // 当前高度(m)
    double current_velocity;  // 当前速度(m/s)
    double current_heading;   // 当前航向(度)
    double target_latitude;   // 目标纬度(度)
    double target_longitude;  // 目标经度(度)
    double target_altitude;   // 目标高度(m)
    double max_velocity;      // 最大速度(m/s)
    double max_acceleration;  // 最大加速度(m/s²)
    double timestamp;         // 时间戳(s)
} PresetTrajectoryInput;

// 输出结构体 (全部基本数据类型)
typedef struct
{
    double waypoint1_lat;        // 航路点1纬度
    double waypoint1_lon;        // 航路点1经度
    double waypoint1_alt;        // 航路点1高度
    double waypoint2_lat;        // 航路点2纬度
    double waypoint2_lon;        // 航路点2经度
    double waypoint2_alt;        // 航路点2高度
    double waypoint3_lat;        // 航路点3纬度
    double waypoint3_lon;        // 航路点3经度
    double waypoint3_alt;        // 航路点3高度
    int waypoint_count;          // 航路点数量(1-3)
    double target_velocity; // 推荐速度(m/s)
    double target_angle;  // 推荐航向(度)
    double climb_angle;          // 爬升角(度)
    double target_altitude;   // 到目标距离(m)
    double estimated_time;       // 预计时间(s)
    double max_deviation;        // 最大允许偏差(m)
    double energy_consumption;   // 能量消耗估计
    double risk_factor;          // 风险系数(0-1)
    double trajectory_score;     // 轨迹评分(0-100)
    double wind_compensation;    // 风补偿量
    double temp_compensation;    // 温度补偿量
} PresetTrajectoryOutput;

/*------------------------  Message Info End  --------------------------*/

/*------------------------  Interface Declaration Begin  --------------------------*/

// 预设弹道信息主函数
int getPresetTrajectoryInfo(PresetTrajectoryInput *input,
                            PresetTrajectoryOutput *output);

/*------------------------  Interface Declaration End  --------------------------*/

// 计算两点间距离(大圆距离)
double calculateDistance(double lat1, double lon1, double lat2, double lon2);
// 计算初始航向
double calculateBearing(double lat1, double lon1, double lat2, double lon2);

#endif // _ATOMIC_0701_YSDD_H_
